<!doctype html>
<html class="no-js">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport"
          content="width=device-width, initial-scale=1">
    <title>发起挑战</title>

    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">

    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp"/>

    <link rel="icon" type="image/png" href="assets/i/favicon.png">

    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <link rel="icon" sizes="192x192" href="assets/i/app-icon72x72@2x.png">

    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">

    <!-- Tile icon for Win8 (144x144 + tile color) -->
    <meta name="msapplication-TileImage" content="assets/i/app-icon72x72@2x.png">
    <meta name="msapplication-TileColor" content="#0e90d2">


    <link rel="stylesheet" href="../assets/css/amazeui.min.css">
    <link rel="stylesheet" href="../assets/js/layui/css/layui.css">
    <link rel="stylesheet" href="../assets/css/global.css">

    <link rel="stylesheet" href="../assets/css/choose.css">


    <link rel="stylesheet" href="../assets/css/challenge.css">



</head>
<body>
<div class="app-bg"></div>

<div class="app-main" id="index_div">

    <div class="challenge-wrap">
        <div class="challenge-title am-text-center" v-cloak>
            <span>选择你的挑战赏金，额度越大，难度越大</span>
            <span >{{config_info.withdraw_time}}小时后无人成功领取赏金，即可撤回挑战</span>
        </div>

        <div class="challenge-content-box" v-cloak>

            <!--挑战列表-->
            <div class="challenge-item" v-for="(rule,index) in rules_list">
                <img src="../images/challenge_trophy.png" width="80" alt="">
                <div class="challenge-item-box">
                    <div class="challenge-item-content">
                        <span class="total-money">发起{{rule.money | integral}}元挑战</span>
                        <span class="money">每位好友参与挑战时需支付{{rule.answer_money | integral}}元挑战金</span>
                        <div class="choose-box">
                            <input type="radio" name="money" :id="rule.id | getIdStr" :value="rule.id" class="radio-label" :checked="index==0" :data-money="rule.money">
                            <label :for="rule.id | getIdStr">&nbsp;</label>
                        </div>
                    </div>
                </div>
            </div>
            <!--挑战列表End-->


            <div class="challenge-footer am-text-center">
                <div class="footer-choose-box">
                    <input type="checkbox" checked name="is_visible" id="is_visible" value="1" class="checkbox-label">
                    <label for="is_visible">&nbsp;勾选显示在挑战广场与周边的挑战</label>

                </div>
            </div>
            <div class="challenge-btn-box margintop15">
                <span class="challenge-btn" @click="onInitiateChallenge">发起挑战</span>
            </div>
        </div>
    </div>


</div>


<!--底部导航栏-->
<div data-am-widget="navbar" class="am-navbar am-cf am-navbar-default"
     id="">
    <ul class="am-navbar-nav am-cf am-avg-sm-4">
        <li>
            <a href="index.html">
                <img src="../assets/i/square.png" alt="挑战广场"/>
                <span class="am-navbar-label ">挑战广场</span>
            </a>
        </li>
        <li>
            <a href="javascript:void(0);">
                <img src="../assets/i/trophy_active.png" alt="发起挑战"/>
                <span class="am-navbar-label active">发起挑战</span>
            </a>
        </li>
        <li>
            <a href="user.html">
                <img src="../assets/i/user.png" alt="个人中心"/>
                <span class="am-navbar-label">个人中心</span>
            </a>
        </li>
    </ul>
</div>
<!--底部导航栏End-->


<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="../assets/js/jquery.min.js"></script>
<!--<![endif]-->
<script src="../assets/js/amazeui.min.js"></script>
<script src="../assets/js/layui/layui.js"></script>
<script src="../assets/js/global.js"></script>
<script src="../assets/js/vue.js"></script>

<!--页面内js-->
<script src="../assets/js/frontend/challenge.js"></script>

<script>
    //调用微信JS api 支付
    function jsApiCall()
    {
        WeixinJSBridge.invoke(
                'getBrandWCPayRequest',
                {
                    "appId": jsApiParameters.appId,
                    "nonceStr":jsApiParameters.nonceStr,
                    "package": jsApiParameters.package,
                    "paySign":jsApiParameters.paySign,
                    "signType": jsApiParameters.signType,
                    "timeStamp": jsApiParameters.timeStamp
                },
                function(res){
                    WeixinJSBridge.log(res.err_msg);
//                    alert(res.err_code+res.err_desc+res.err_msg);
                    console.info(res.return_code);
                    if(res.err_msg == "get_brand_wcpay_request:ok"){
                        window.location.href= '/pages/my_challenge.html';
                    }
                }
        );
    }

    function docallpay()
    {
        if (typeof WeixinJSBridge == "undefined"){
            if( document.addEventListener ){
                document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
            }else if (document.attachEvent){
                document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
            }
        }else{
            jsApiCall();
        }
    }
</script>

</body>
</html>
